----------------------------------Spell Variables--------------------------------------
SPELL.m_iSpellID = 74534 -- Whatever value you want as long as it doesn't override any other spells' IDs.
SPELL.m_iRange = 1024
SPELL.m_sName = "Exorcism"
SPELL.m_sToolTip = [[You smite the target
					with holy energy.]]
SPELL.m_sIcon = "devin/blackbetty/spells/brawler/dropkick.png"
SPELL.m_bRequiresTarget = true
SPELL.m_iManaCost = 3
SPELL.m_iCoolDown = 0.5
SPELL.m_iSpellType = SPELLTYPE_MAA
SPELL.m_bRecastWhileCasting = false

---------------------------------------------------------------------------------------

local range = 100

function SPELL:Cast( pl, target )
	
	if(target && target:IsValid() && target != pl ) then
		pl:DoAnimationEvent(ACT_DI_ALYX_ANTLION)
		pl:EmitSound("devin/blackbetty/weapons/SoulstoneResurrection.wav", 150, 100+math.random(20,30))
		ParticleEffectAttach("light_hands", PATTACH_POINT_FOLLOW, pl, pl:LookupAttachment("anim_attachment_RH"))
		timer.Simple(0.45, function()
			pl:StopParticles()
			if(target and pl:GetPos():Distance(target:GetPos()) < self.m_iRange)then
				ParticleEffectAttach( "light_hands_instacast", PATTACH_POINT_FOLLOW, pl, pl:LookupAttachment("anim_attachment_RH"))
				self:Effect(pl, target)
				pl:SetNWString("HoldType", "knife")
				--self:ApplySpellMods(self, pl, target)
			end
		end)
	end
end

function SPELL:Effect(pl, target)

	local weapon = nil
	if(pl:IsPlayer())then
		weapon = pl:GetWeapon("weapon_all")
	end
	target:EmitSound("devin/blackbetty/weapons/Exorcism.wav", 150, 100+math.random(-10,-30))
	ParticleEffect( "impact_light_damage", target:GetPos() + Vector(0, 0, 46) + (target:GetAngles():Forward()*6), Angle(0,0,0), pl )
	if(SERVER)then
		target:SetVelocity(((pl:GetPos()- Vector(0, 0, 40)) - target:GetPos())*-3.25)
		if(weapon)then
			self:DealDamage(weapon.MinWeaponDamage*3, weapon.MaxWeaponDamage*3, pl, target, DMG_GENERIC)
		else
			self:DealDamage(pl.MinDamage*2.25, pl.MaxDamage*2.25, pl, target, DMG_GENERIC)
		end
	end
end



